package com.leef.glidetest.glide;

import android.content.Context;

import com.bumptech.glide.Glide;
import com.bumptech.glide.GlideBuilder;
import com.bumptech.glide.load.DecodeFormat;
import com.bumptech.glide.module.GlideModule;
import com.bumptech.glide.request.target.ViewTarget;
import com.leef.glidetest.R;
import com.leef.glidetest.bean.SecretData;

import java.io.InputStream;

/**
 * Created by IWALL on 2016/3/18.
 * glide model
 */
public class SecretGlideModel implements GlideModule {
    @Override
    public void applyOptions(Context context, GlideBuilder builder) {
        ViewTarget.setTagId(R.id.glide_tag_id);
        builder.setDecodeFormat(DecodeFormat.PREFER_ARGB_8888);
    }

    @Override
    public void registerComponents(Context context, Glide glide) {
        glide.register(SecretData.class, InputStream.class, new SecretModelLoader.Factory());
    }
}
